﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using AtletIS.Repository.UnitOfWork;
using AtletIS.Service.Base;
using AtletIS.DomainModel.Entities.Main;

namespace AtletIS.Service.Services
{
    public class CheckPointsService : ServiceBase
    {

        #region Constructor

        public CheckPointsService()
        {
            this._unitOfWork = new UnitOfWork();
        }

        public CheckPointsService(IUnitOfWork unitOfWork)
        {
            this._unitOfWork = unitOfWork;
        }

        #endregion

        public CheckPoint GetById(int checkPointId)
        {
            try
            {
                return this._unitOfWork
                    .Repository<CheckPoint>()
                    .Query(cp => cp.ID == checkPointId)
                    .Include(i => i.DisciplineList)
                    .Select()
                    .FirstOrDefault();
            }
            catch (Exception ex)
            {
                this.Error = 1;
                this.ErrorText = ex.Message;
                return null;
            }
        }




    }
}
